package com.mvp.shq.washer.ui.setting;

import com.mvp.shq.washer.APP;
import com.mvp.shq.washer.jpush.TagAliasOperatorHelper;
import com.mvp.shq.washer.utils.SpUtil;

import cn.jpush.android.api.JPushInterface;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/8/24.
 */

public class SettingPresenter extends SettingConstract.Presenter {
    @Override
    public void onStart() {

    }

    @Override
    public void loginout() {
        int sequence = 1;
        String alias = SpUtil.getUser().getId();
        TagAliasOperatorHelper.TagAliasBean bean = new TagAliasOperatorHelper.TagAliasBean();
        bean.setAliasAction(true);
        bean.setAlias(alias);
        bean.setAction(TagAliasOperatorHelper.ACTION_DELETE);
        TagAliasOperatorHelper.getInstance().handleAction(APP.getAppContext(),sequence,bean);
//        Observable.create(new ObservableOnSubscribe<String>() {
//            @Override
//            public void subscribe(@NonNull ObservableEmitter<String> e) throws Exception {
//                JPushInterface.deleteAlias(APP.getAppContext(),sequence);
//            }
//        }).subscribeOn(Schedulers.newThread())
//                .subscribe(new Consumer<String>() {
//                    @Override
//                    public void accept(@NonNull String s) throws Exception {
//
//                    }
//                });
    }
}
